#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2016/11/13 14:16
# @Author  : tanzhenlong
import sys

reload(sys)
sys.setdefaultencoding('utf8')


import xlwt
workbook = xlwt.Workbook(encoding='utf-8')
worksheet = workbook.add_sheet('My Sheet')
pattern = xlwt.Pattern() # Create the Pattern
pattern.pattern = xlwt.Pattern.SOLID_PATTERN # May be: NO_PATTERN, SOLID_PATTERN, or 0x00 through 0x12
pattern.pattern_fore_colour = 2 # 0 = Black, 1 = White, 2#红色  = Red, 3 = Green绿色, 4 = Blue蓝色, 5 = Yellow黄, 6 = Magenta品红, 7 = Cyan青,  17 = Dark Green深绿, 18 = Dark Blue深蓝, 19 = Dark Yellow , almost brown), 20 = Dark Magenta, 21 = Teal, 22 = Light Gray, 23 = Dark Gray, the list goes on...
style = xlwt.XFStyle() # Create the Pattern
style.pattern = pattern # Add Pattern to Style
worksheet.write_merge(0, 0, 0, 2, '统计',style) #合并单元格
workbook.save('D://Excel_Workbook.xls')